// 处理全局category数据
import { getCategory } from '@/api/category'

export default {
  namespaced: true,
  state: () => {
    return {
      categorys: []
    }
  },
  mutations: {
    setCategorys(state, newCategorys) {
      state.categorys = [...newCategorys]
    }
  },
  actions: {
    async useCategoryData(context) {
      const res = await getCategory()
      context.commit('setCategorys',res)
    }
  }
}
